/**
  ETFRoot project, Anyang Normal University && IMP-CAS
  \class ETFPXISection
  \brief class for holding a section (i.e. an event) for PXI daq
  \author SUN Yazhou, asia.rabbit@163.com
  \since 2021-09-27
  \date 2021-10-10 last modified
  \attention
  changelog
  <table>
  <tr>  <th>Date         <th>Author      <th>Description                   </tr>
  <tr>  <td>2021-09-27   <td>Asia Sun    <td>file created                  </tr>
  <tr>  <td>2021-10-10   <td>Asia Sun    <td>added channel arrays          </tr>
  </table>

  \copyright Copyright (c) 2021 Anyang Normal U. && IMP-CAS with LGPLv3 LICENSE
*/

#ifndef ETFPXISection_h
#define ETFPXISection_h

#include <TNamed.h>
#include "section_head.h"

class TClonesArray;

class ETFPXISection : public TNamed{
public:
  ETFPXISection();
  ETFPXISection(const ETFPXISection &sec);
  virtual ~ETFPXISection();

  virtual void Reset();
  ///@{ getters
  const section_head &GetSectionHead() const{ return fSectionHead; }
  int GetEventIndex() const{ return fSectionHead.index; }
  unsigned GetBunchID() const; ///< bunchid of the first fragment
  const int GetSectionLength() const{ return fSection_len; }
  TClonesArray *GetFragments() const;
  TClonesArray *GetHPTDCChannels() const;
  TClonesArray *GetAmplitudeChannels() const;
  ///@}

  virtual void PrintBunchID() const;
  virtual void PrintEventID() const;
  virtual void Print() const;

  friend class ETFPXIUnpacker;

  ClassDef(ETFPXISection, 1); ///< PXI data section class

protected:
  section_head fSectionHead;
  int fSection_len; ///< data length of an event
  TClonesArray *fFragments; //! a fragment is a PXI daq card
  TClonesArray *fHPTDCChannels; //! for HPTDC time channels
  TClonesArray *fAmplitudeChannels; //! for amplitudes, e.g. MUSIC & TAC signals
};

#endif
